<%@ page import="com.opensymphony.xwork2.util.ValueStack" %>
<%@ page import="control.ComputerInfo" %>
<%@ page import="java.util.List" %>
<%@ page import="control.ControlVar" %>
<%@ page import="account.AccountUtils" %>
<%@ page import="utils.Var" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title></title>
<link href="../../skin/default/global.css" rel="stylesheet" type="text/css" />
<link href="../../skin/default/layout.css" rel="stylesheet" type="text/css" />
<link href="../../common/ui.suggest.css" rel="stylesheet" type="text/css" />
 <style>
    html,body{overflow-x:hidden}
    </style>
</head>
<%
  boolean isControlExaminee = AccountUtils.hasRight(session, Var.RIGHT_CONTROL_EXAMINEE);
  boolean isControlIp = AccountUtils.hasRight(session, Var.RIGHT_CONTROL_IP);

  ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");
  List<ComputerInfo> computers = (List<ComputerInfo>) vs.findValue("list");
%>
<body class="admin-content">

	<div class="admin-content-control">
		<div class="caption">
			<ul>
				<li><b class="status-1"></b>已交卷</li>
				<li><b class="status-2"></b>空闲中</li>
				<li><b class="status-3"></b>已安排</li>
				<li><b class="status-4"></b>使用中</li>
				<li><b class="status-5"></b>维护中</li>
			</ul>
			<div class="bar">
        <%
          if(isControlIp){
        %>
        <button type="button" onclick="kswindow.open({title:'控制台设置',url:'getControlSetting.action'})" class="normal blue"><span></span>控制台设置</button>
        <%
          }
        %>
        <%--<button type="button" onclick="kswindow.open({title:'导入Excel',url:'import.jsp'})" class="normal">--%>
          <!--<span></span><img src="../../skin/default/excel.gif" alt="导入Excel" />导入Excel</button>-->
			</div>
			<div style="clear:both"></div>

			<div class="panelbox">
        <%
          for(int i = 0; i < computers.size(); i++){
            ComputerInfo computer = computers.get(i);
        %>
				<div class="panel status-<%=computer.getState()%>" <%if(isControlExaminee){%>onclick="kswindow.open({title:'<%=i + 1%>号机状态',url:'monitor.action?cid=<%=computer.getCid()%>',width:900})"<%}%>>
					<h1>
			
            
			<%
              if(isControlExaminee) {
            %>
            <span class="users" title="考生设置" onclick="kswindow.open({title:'<%=i + 1%>号机设定',url:'getComputerUser.action?cid=<%=computer.getCid()%>'})"></span>
            <%
              }
            %>
			<%
              if(isControlIp) {
            %>
            <span class="ip" title="ip设置" onclick="kswindow.open({title:'<%=i + 1%>号机设定',url:'getComputerIP.action?cid=<%=computer.getCid()%>'})"></span>
            <%
              }
			%>
			<%=i + 1%>
			</h1>
          <p>
						<%=computer.getZkzh() == null ? "" : computer.getZkzh()%>
						
						<span><%=computer.getEname()==null?"":computer.getEname()%></span>
						<!--<span>准考证号</span>-->
					</p>
				</div>
        <%
          }
        %>
			</div>			

		</div>
	</div>
<iframe name="execute" src="" width="0" height="0"></iframe>
<script src="../../common/jquery-1.3.2.min.js"></script>
<script src="../../common/jquery.blockUI.js"></script>
<script src="../../common/ui.suggest.js"></script>
<script src="../../common/fun.js"></script>
<script>
	$(function(){
	kswindow = new KS.Window();
	panels = new KS.contorlpanel();
	window.setInterval(function(){
    panels.LoadStatus("getComputerStatus.action")
	},<%=ControlVar.CONTROL_STATUS_INTERVAL%>)
	kaohao = new ksUI.Suggest("mysuggest","getExaminees.action")
	})
	
</script>
</body>

</html>